<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateTableAlarmRecord extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        //新建报警记录表
        $table = $this->table('alarm_record', array('engine' => 'MyISAM'));
        $table
            ->addColumn('app_id', 'integer', array('limit' => 10, 'comment' => '申请表单ID'))
            ->addColumn('reason', 'integer', array('limit' => 10, 'comment' => '1:用章超过次数 2用章完成超时没有上传图片'))
            ->addColumn('seal_id', 'integer', array('limit' => 10, 'comment' => '印章ID'))
            ->addColumn('uid', 'integer', array('limit' => 10, 'comment' => '用户ID'))
            ->addColumn('lat', 'string', array('limit' => 255, 'default' => '', 'comment' => '纬度'))
            ->addColumn('lng', 'string', array('limit' => 255, 'default' => '', 'comment' => '经度'))
            ->addColumn('create_time', 'integer', array('comment' => '时间'))
            ->create();
    }
}
